<template>
    <div class="footer">
        <div class="index" @click="funIndex">
            <img src="https://img.alicdn.com/imgextra/i2/O1CN01OStgh21aWOP69RsTZ_!!6000000003337-2-tps-63-63.png"
                alt="">
            <p>首页</p>
        </div>
        <div class="cart" @click="funCart">
            <img :src="cart" alt="">
            <p :class="{ fsColor: current == '1' }">购物车</p>
        </div>
        <div class="mySelf" @click="funMy">
            <img :src="my" alt="">
            <p :class="{ fsColor: current == '2' }">我的</p>
        </div>
    </div>
</template>

<script>
export default {
    name: "myBottomNav",
    props: ["cart", "my", "current"],
    methods: {
        funIndex() {
            this.$router.push("/")
        },
        funCart() {

            if (localStorage.getItem("token")) {
                this.$router.push("/cart").catch(err => { })
            } else {
                this.$router.push("/loginCode").catch(err => { })
            }
        },
        funMy() {
            if (localStorage.getItem("token")) {
                this.$router.push("/my").catch(err => { })
            } else {
                this.$router.push("/loginCode").catch(err => { })
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.footer {
    width: 100%;
    height: 0.9rem;
    background: #ffffff;
    position: fixed;
    bottom: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.footer>div {
    width: 0.75rem;
    height: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    color: #666666;
    font-size: 0.2rem;
}

.footer>div img {
    width: 0.42rem;
    height: 0.42rem;
}

.fsColor {
    color: #ff5000;
}
</style>